package com.td.erhome.ui.login;

import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.CountDownTimer;
import android.view.View;

import com.td.erhome.R;
import com.td.erhome.base.BaseActivity;
import com.td.erhome.ui.home.HomeActivity;

public class StartActivity extends BaseActivity {

    private CountDownTimer mTimer;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_start;
    }

    @Override
    protected void initView() {

        if (Build.VERSION.SDK_INT >= 21) {
            View decorView = getWindow().getDecorView();
            int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
            decorView.setSystemUiVisibility(option);
            getWindow().setStatusBarColor(Color.TRANSPARENT);
        }

        mTimer = new CountDownTimer(2000,1000){
            @Override
            public void onTick(long millisUntilFinished) {

            }
            @Override
            public void onFinish() {
                    startActivity(new Intent(StartActivity.this,HomeActivity.class));
                    finish();
            }
        }.start();

    }

    @Override
    protected void releaseResource() {
        if (mTimer!=null){
            mTimer = null;
        }

    }
}
